<template>
    <div>
        <h1>父组件</h1>
        <div>数字：{{ number }}</div>
        <button @click="addNumber">+1</button>
        <hr>
        <GlobalConponent title="你好，我是爸爸辈的！"></GlobalConponent>
        <hr>
        <LocalConponent></LocalConponent>
    </div>

</template>

<!--选项式
<script>
export default {
    data(){
        return {
            number: 0
        }
    },
    methods:{
        addNumber(){
            this.number++;
        }
    }
}
</script>
-->

<!--组合式-->
<script setup>
    import {ref} from 'vue';
    import LocalConponent from './LocalConponent.vue' ;
    let number = ref(0);
    let addNumber = ()=>{
        number.value++;
    }
</script>

<style>

</style>